package com.sun.designpatternsdemo.visitor

import android.os.Bundle
import com.sun.designpatternsdemo.R
import com.sun.designpatternsdemo.app.AppConstant
import com.sun.designpatternsdemo.app.EMTagHandler
import com.sun.designpatternsdemo.base.BaseActivity
import com.sun.designpatternsdemo.databinding.ActivityVisitorBinding

class VisitorActivity : BaseActivity<ActivityVisitorBinding>() {

    override fun layoutId(): Int =R.layout.activity_visitor

    override fun initView(savedInstanceState: Bundle?) {
        title = "访问者模式"
        mDataBind.apply {
            tvDefine.text = EMTagHandler.fromHtml(AppConstant.VISITOR_DEFINE)
            btComputer.setOnClickListener {
                val computer = Computer()
                computer.accept(ComputerPartDisplayVisitor())
            }
        }
    }
}